package com.dhcc.core.config.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 默认线程池配置
 * @ClassName: ThreadPoolProperties 
 * @Description: TODO
 * @author: cyf
 * @date: 2018年11月11日 下午5:27:35
 */
@Configuration
@ConfigurationProperties(prefix = ThreadPoolProperties.CONF_PREFIX)
public class ThreadPoolProperties {

    public static final String CONF_PREFIX = "spring.task.pool";

    // 线程池的基本大小
    private int corePoolSize = 1;

    // 线程池中允许的最大线程数
    private int maxPoolSize = Integer.MAX_VALUE;

    // 线程池维护线程所允许的空闲时间，默认为60s
    private int keepAliveSeconds = 60;

    // 队列最大长度
    private int queueCapacity = Integer.MAX_VALUE;

    // 允许核心线程超时
    private boolean allowCoreThreadTimeout = false;

    public int getCorePoolSize() {
        return corePoolSize;
    }

    public void setCorePoolSize(int corePoolSize) {
        this.corePoolSize = corePoolSize;
    }

    public int getMaxPoolSize() {
        return maxPoolSize;
    }

    public void setMaxPoolSize(int maxPoolSize) {
        this.maxPoolSize = maxPoolSize;
    }

    public int getKeepAliveSeconds() {
        return keepAliveSeconds;
    }

    public void setKeepAliveSeconds(int keepAliveSeconds) {
        this.keepAliveSeconds = keepAliveSeconds;
    }

    public int getQueueCapacity() {
        return queueCapacity;
    }

    public void setQueueCapacity(int queueCapacity) {
        this.queueCapacity = queueCapacity;
    }

    public boolean getAllowCoreThreadTimeout() {
        return allowCoreThreadTimeout;
    }

    public void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) {
        this.allowCoreThreadTimeout = allowCoreThreadTimeout;
    }

}
